package com.doit.demo06;

import java.io.File;

public class test_delet {
    public static void main(String[] args) {
        File file = new File("D:\\work");
        dele(file);
    }
//删除java文件
    private static void dele(File file) {
        File[] files = file.listFiles();
        for (File file1 : files) {
            if(file1.isFile())
            {
//                System.out.println(file1);
                boolean equals = file1.getName().toLowerCase().endsWith(".java");
                if(equals)
                    file1.delete();
            }
            else
                dele(file1);
        }

    }
}
